home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9786 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  46 lines

  1. Newsgroups: comp.lang.c
  2. Path: phcoms4.seri.philips.nl!misf1!Pvestjen
  3. From: Pvestjen@ms.philips.nl (Patrick Vestjens)
  4. Subject: Re: Help !!!!! on 'strstr"
  5. Message-ID: <1996Mar13.074034.9064@ms.philips.nl>
  6. Sender: news@ms.philips.nl
  7. Organization: Philips Medical Systems, Best
  8. X-Newsreader: TIN [version 1.2 PL2]
  9. References: <314703FF.4045@msmail.st.stems.com>
  10. Date: Wed, 13 Mar 1996 07:40:34 GMT
  11.  
  12. kim hai (Kim_Hai.Ng@msmail.st.stems.com) wrote:
  13. : Help !!!!!
  14.  
  15. : Problem :
  16. :     I need to locate a string within another string, and the process 
  17. : must be case insensitive. As far as I know, strstr() only locates the 
  18. : exact match and is case sensitive.
  19. :     Does anyone konw of any functions that could allow me to locate 
  20. : substrings and is case insensitive ?
  21.  
  22. : Eg.
  23. : case 1:
  24. :     string1 = "abc"
  25. :     string2 = "abcdef" 
  26. : case 2:
  27. :     string2 = "Abcdef"
  28. : case 3:
  29. :     string3 = "aBcdef"
  30. : case 4:
  31. :     string4 = "abCdef"
  32. : ...
  33. : ..
  34. : .
  35.  
  36. : Is taking care of all the combinations ( = 8) in string1 the only 
  37. : solution ? I'm working on Unix platform.
  38.  
  39. One other solution is that you first convert both strings to lower or
  40. upper case and then do the strstr. Another option is to get the source
  41. of strstr and put some tolower or toupper functions in it to make it
  42. case insensitive.
  43.  
  44. Success, Patrick.
  45.  
  46.